from __future__ import absolute_import
from __future__ import unicode_literals

import pytest

from pre_commit_hooks.forbid_chinese import main as forbid_chinese


@pytest.mark.parametrize(
    ('input_s', 'expected'),
    (
            ('foo\r\nbar你好', True),
            ('bar\nbaz\r\n', False),
    ),
)
def test_remove_chinese(input_s, expected, tmpdir):
    path = tmpdir.join('file.txt')
    path.write(input_s)

    assert forbid_chinese([path.strpath]) == expected
